package com.laborder.sysyy.controller.log;


import com.laborder.sysyy.service.log.LogService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @Function: 日志控制层
 * @author: 786107529@qq.com FJL
 * @date:2018/8/25 11:29
 */
@Controller
@RequestMapping("log")
public class LogController {
	private static Logger logger = Logger.getLogger(LogController.class);
	@Autowired
	private LogService logService;
	@GetMapping("toLog")
	public String toLog(){
		return "log/logList";
	}
	@ResponseBody
	@RequestMapping("findLogWithPage")
	public Map<String,Object> findLogWithPage(int page, int limit, String userName, String operation){
		Map<String, Object>map =new HashMap<String,Object>();

		map.put("page", (page-1)*limit);
		map.put("limit", limit);
		map.put("userName", userName);
		map.put("operation", operation);
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("code", 0);
		resultMap.put("msg", "");
		resultMap.put("count", logService.getLogCount(map));
		resultMap.put("data", logService.findLogWithPage(map));
		return resultMap;
	}
}
